#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "widget.h"

#include <QtCore>
#include <QtGui>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
	Widget *v_w = new Widget(this);
	setCentralWidget(v_w);

	QAction *m_find = ui->menuEdit->addAction(tr("&Find"));
	m_find->setShortcuts(QKeySequence::Find);
	connect(m_find, SIGNAL(triggered()), v_w, SLOT(slotEditFind()));
	new QShortcut(QKeySequence(Qt::Key_Slash), v_w, SLOT(slotEditFind()));

	QAction *m_findNext = ui->menuEdit->addAction(tr("&Find Next"));
	m_findNext->setShortcuts(QKeySequence::FindNext);
	connect(m_findNext, SIGNAL(triggered()), v_w, SLOT(slotEditFindNext()));

	QAction *m_findPrevious = ui->menuEdit->addAction(tr("&Find Previous"));
	m_findPrevious->setShortcuts(QKeySequence::FindPrevious);
	connect(m_findPrevious, SIGNAL(triggered()), v_w, SLOT(slotEditFindPrevious()));

	statusBar();
	statusBar()->showMessage(tr("Ready"), 2000);
	//this->setMaximumWidth(1000);
	resize(1250, 500);

	move(0, 0);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
